﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.ApplicationModel.Background;
using Windows.UI.Notifications;
namespace ClockLib
{
    public sealed class ClockBackgroundTaskEntry : IBackgroundTask
    {

        public void Run(IBackgroundTaskInstance taskInstance)
        {
            var deferral=taskInstance.GetDeferral();
            ToastNotificationHistoryChangedTriggerDetail triggerDetail = taskInstance.TriggerDetails as ToastNotificationHistoryChangedTriggerDetail;
            if(triggerDetail != null)
            {
                ClockManager.Instance.ActiveNextClock();
            }
            deferral.Complete();
        }
    }
}
